﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using eSeller.Models;

namespace eSeller
{
    public static class UiHelper
    {
        public static string GetUiValue(this HtmlHelper input, UiData value, string key, string defaultValue)
        {
            if (value == null || key == null)
                return defaultValue;
            switch (key)
            {
                case "Width":
                    return value.Width == null ? defaultValue: value.Width + "px";
                case "Height":
                    return value.Height == null ? defaultValue : value.Height + "px";
                case "Left":
                    return value.X == null ? defaultValue : value.X + "px";
                case "Top":
                    return value.Y == null ? defaultValue : value.Y + "px";
                case "BgColor":
                    return value.BgColor ?? defaultValue;
                default:
                    throw new Exception("Cannot get pixel value");
            }

            
        }
    }
}
